<%--
*
* 描述：编码表SYSTEM_CODE的list文件列表
* 
* @author tch  
*
--%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="g" uri="/fishergrid-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title><s:property value="operate"/>编码列表</title>
	<%@include file="/share/header.jsp"%>
	<s:head/>	
	<g:header theme="${sessionScope.skinCon.gridSkin}"/>	
  </head>
  <body>
	<script type="text/javascript">
		//新增编码
		function onDoAdd(name,g){
			var options={
				title:'【新增编码】',
				url:'<s:url action='new' namespace='/system/code'/>',
				source : window,
				buttons:[top.MyWindow.Save,top.MyWindow.Cancel],
				multiplewidth:1,
				multipleheight:1,
				tipstitle:'',
				tipscontent:''
			};
			top.MyWindow.open(options);
		}
		//新增编码明细		
		function onDoOperateRenderer(tdDiv,pid){
			$(tdDiv).html("");//去除原有的内容
			var addoptions={
				title:'【新增编码明细】',
				url:'<s:url action="new" namespace='/system/codeitem'/>?domain.code.id='+getIndex(pid,1),
				source : window,
				buttons:[top.MyWindow.Save,top.MyWindow.Cancel],
				multiplewidth:1,
				multipleheight:1,
				tipstitle:'注意说明：',
				tipscontent:'<br>1.【扩展1】设置编码类型字段在列表中的显示颜色值;'
			};
			var addhtml='<a href="javascript:void(0);" title="新增编码明细">新增编码明细</a>';
			$(tdDiv).append($(addhtml).click(function(){//添加链接
											top.MyWindow.open(addoptions);
										})
							);							
		}	
		//修改编码		
		function onDoCodeRenderer(tdDiv,pid){
			var options={
				title:'【修改编码】',
				url:'<s:url action="edit" namespace='/system/code'/>?domain.id='+getIndex(pid,1),
				source : window,
				buttons:[top.MyWindow.Save,top.MyWindow.Close],
				multiplewidth:1,
				multipleheight:1,
				tipstitle:'',
				tipscontent:''
			};			
			var viewhtml='<a href="javascript:void(0);" title="修改【'+$(tdDiv).html()+'】">'+$(tdDiv).html()+'</a>';
			$(tdDiv).html("");//去除原有的内容
			$(tdDiv).append($(viewhtml).click(function(){//添加链接
											top.MyWindow.open(options);
										})
							);				
		}	
		//修改编码明细		
		function onDoCodeItemRenderer(tdDiv,pid){
			var id= getIndex(pid,2);
			if(null!=id&&id!='')
			{
				var options={
					title:'【修改编码明细】',
					url:'<s:url action="edit" namespace='/system/codeitem'/>?domain.id='+getIndex(pid,2),
					source : window,
					buttons:[top.MyWindow.Save,top.MyWindow.Cancel],
					multiplewidth:1,
					multipleheight:1,
					tipstitle:'注意说明：',
					tipscontent:'<br>1.【扩展1】设置编码类型字段在列表中的显示颜色值;'
				};
				var edithtml='<a href="javascript:void(0);" title="修改【'+$(tdDiv).html()+'】">'+$(tdDiv).html()+'</a>';
				$(tdDiv).html("");//去除原有的内容
				$(tdDiv).append($(edithtml).click(function(){//添加链接
												top.MyWindow.open(options);
											})
								);
			}					
		}			
		//删除编码
		function onDoDeleteCode(name,grid){
			onDoAjax({url:'<s:url action='deletes' namespace='/system/code'></s:url>',index:1});
		}
		//删除编码明细
		function onDoDeleteCodeItem(name,grid){
			onDoAjax({url:'<s:url action='deletes' namespace='/system/codeitem'></s:url>',index:2});
		}			
		//启用编码明细
		function onDoEnable(name,grid){
			onDoAjax({url:'<s:url action='changes' namespace='/system/codeitem'></s:url>?domain.state=1',index:2,tip:'启用'});
		}
		//停用编码明细
		function onDoUnEnable(name,grid){
			onDoAjax({url:'<s:url action='changes' namespace='/system/codeitem'></s:url>?domain.state=2',index:2,tip:'停用'});
		}
		//复制编码明细
		function onDoCopy(name,grid){
			onDoAjax({url:'<s:url action='copys' namespace='/system/codeitem'></s:url>?copyName=name',index:2,tip:'复制'});
		}	
		//批量保存
		function onDoSaves(name,grid){
			fisherSaves({url:'<s:url action='saves' namespace='/system/codeitem'></s:url>',index:2});
		}											
	</script>  
  	<s:actionerror/>
  	<g:grid title="编码列表" name="/system/code/code.fisher.xml">
  		<g:select/>
  		<g:separator/>
  		<g:button name="新增【编码】" styleClass="fisherAdd" onclick="onDoAdd"/>
  		<g:button name="复制【明细】" styleClass="fisherCopy" onclick="onDoCopy"/>  		
  		<g:button name="保存【明细】" styleClass="fisherSave" onclick="onDoSaves"/>    		
  		<g:separator/> 
  		<g:button name="启用【明细】" styleClass="fisherCheck" onclick="onDoEnable"/>
  		<g:button name="停用【明细】" styleClass="fisherUncheck" onclick="onDoUnEnable"/>
  		<g:separator/>   
	<s:if test="isSuperAdministrator()">  				  		 
  		<g:button name="删除【编码】" styleClass="fisherDelete" onclick="onDoDeleteCode"/>
  		<g:separator/> 
  		<g:button name="删除【明细】" styleClass="fisherDelete" onclick="onDoDeleteCodeItem"/>
  		<g:separator/> 
  	</s:if>	  		  				
  		<g:query/>
  		<g:separator/>
  		<g:export/>  		
  	</g:grid>
  </body>
</html>
